package by.grsu.hdm.media.remotecontrol;

import by.grsu.hdm.devices.MediaCenter;
import by.grsu.hdm.exeption.NoReproductionFormatException;

import by.grsu.hdm.media.Track;

public class Button {
	private String buttonName;
	private String action;

	public String getButtonName() {
		return buttonName;
	}

	public String getAction(MediaCenter media, Track track)
			throws NoReproductionFormatException {
		
			if ( media.getMediaPlayer().getFormats().containsKey(track.getType())) {
				action = this.action + track.getName();
			} else {
				throw new NoReproductionFormatException(
						"No reprodution this file " + track.getName() + " "
								+ media.getMediaPlayer().getPlayerName()
								+ " not supported format " + track.getType());
			}

		
		return action;
	}

	public Button() {

	}

	public Button(String buttonName, String action) {
		this.buttonName = buttonName;
		this.action = action;
	}

}
